package servlet_stanza;

import java.io.IOException;
import java.util.ArrayList;

import javax.servlet.RequestDispatcher;
import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import dao_stanza.GestoreStanza;

/**
 * Servlet implementation class listaStanze
 */
@WebServlet("/listaStanze")
public class listaStanze extends HttpServlet {
	private static final long serialVersionUID = 1L;
    private GestoreStanza gestore=new GestoreStanza();
    private ArrayList<bean.Stanza>stanze;
	
	protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
	
		RequestDispatcher rd;
		Integer id_casa=Integer.parseInt(request.getParameter("id_casa"));

		this.stanze=gestore.getStanze(id_casa);
		request.setAttribute("stanze", this.stanze);
		rd=request.getRequestDispatcher("/stanze.jsp");
		rd.forward(request, response);
		
	}

}
